#!/usr/bin/python
# coding = "utf-8"
import json
import time
import Assembly_Clock

# import Assembly_Email

# 為善言小姐姐寫的自動打卡程序

# 设置自动打卡轮回时间，目前禁用
# def sleep_time(hour, min, sec):
#     return hour * 3600 + min * 60 + sec


# main
while 1 == 1:
    # 间隔秒数second
    # second = sleep_time(0, 0, 5)
    # time.sleep(second)
    # 刷新
    time_now = time.strftime("%H:%M:%S", time.localtime())
    if time_now == "09:10:20":
        fans = open("C://Users/Lenovo/Desktop/AutoClock/data_test.json", "r", encoding="utf-8")
        fanText = json.loads(fans.read())
        user = fanText["user"]

        for i in user:
            Assembly_Clock.clockIn(i['name'], i['number'], i['content'])
            time.sleep(1)
        fans.close()
        # 发送邮件
        # Assembly_Email.send_email('2479711422@qq.com', 200, 0)
        # 清空cmd
        # os.system('cls')
        time.sleep(5)
